package com.mitei.dao.daoimpl;

import java.sql.SQLException;
import java.util.ArrayList;

import com.mitei.dao.abstractdao.AbstractDAO;
import com.mitei.dao.beans.persistants.Bean;
import com.mitei.dao.criteres.CriteresRechercheTables;
import com.mitei.dao.sql.Query;

public class DAO_LA_TABLE extends AbstractDAO {
	
	public DAO_LA_TABLE () {
		super();
	}
	
	public ArrayList<Bean> search(CriteresRechercheTables criteres) throws SQLException {
		Query query = new Query("SELECT *");
		
		query.addTable("LA_TABLE");
		
		if (criteres.getIdent() != null) {
			query.addClause("IDENT=" + criteres.getIdent().toString());
		}
		if (criteres.getChamps1() != null) {
			query.addClause("CHAMPS1=" + criteres.getChamps1().toString());
		}
		if (criteres.getChamps2() != null) {
			query.addClause("CHAMPS2='" + criteres.getChamps2() + "'");
		}
		
		return DAOselect(query.getQuery()) ;
	}

	public void delete(Bean bean) throws SQLException {
		super.DAOdelete(bean);
	}

	public void insert(Bean bean) throws SQLException {
		super.DAOinsert(bean);
	}

	public void update(Bean bean) throws SQLException {
		super.DAOupdate(bean);
	}

}
